import java.util.Scanner;

public class baobingcaixiang {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int[] arr = new int[1000];
        int count = 0;
        arr[0] = num;
        while (num!=1){
            if(num%2!=0){
                num=num*3+1;
            }
            else {
                num=num/2;
            }
            count++;
            arr[count] = num;
        }
        for (int i =count;0<=i;i--){
            System.out.print(arr[i]+" ");
        }
    }
}
